Skip to main content

Plans

Introduction

The Plans API enables you to create and manage subscription plans on your platform. It provides functionality for defining plan details, pricing, and access permissions. This section will help you understand how to set up recurring or prepaid plans, assign collections, and manage plan subscriptions, allowing you to offer flexible and tailored access to your content.

info

Make sure you generated the api_token on your store. More info HERE

Endpoints
Create
Update

Create

POST /integration-api/v1/dashboard/plans

Request Body

ParameterTypeDescription
typestringValid values: recurring, prepaid, Required
namestring
detailsstring
durationnullable, integer
recommendedboolean
privateboolean
assigns_collectionsboolean
concurrency_limitinteger
collectionslist of collections
download_filesboolean
priceslist of prices
free_trialboolean
free_trial_daysintegerThis field can be omitted when free_trial is False
{
"type":"recurring",
"name":"Demo Plan",
"details":"<div><!--block-->This is the description of the Demo Plan</div>",
"duration":null,
"recommended":true,
"private":false,
"assigns_collections":true,
"concurrency_limit":"1",
"collections":[
"Prepaid"
], // Check special considerations about collections ahead
"download_files":false,
"prices":{
"ARS":0,
"USD":"1",
"EUR":0,
"MXN":"1",
"COP":0,
"PEN":0,
"CLP":0,
"AUD":0,
"UYU":0,
"BOB":0,
"PYG":0,
"BRL":0,
"INR":0,
"GTQ":0,
"HNL":0
},
"free_trial":true,
"free_trial_days":"15"
}

Response

CodeDescriptio
201Object Created
422Validation error, the reason of the error will be described in the response

Assigning Collections

To assign collections to the new plan you may query the following endpoint to get available values for your the collections

GET /integration-api/v1/dashboard/plans/collections

Response Example

{"CODE": "success",
"data": ["Collection 1",
"Testing Collection 2",
"Demo Collection",
"Most Recent",
"Most Read",
"For Children"]}

Retrieve

GET /integration-api/v1/dashboard/plans/

Query Parameters

optiontypeendpoint
querystring, query parameter/integration-api/v1/dashboard/plans?query='Test Plan'
tip

Using query parameter you can search by name, type and details of the plans

Response

CodeDescription
200Success
404Object not found
401Unauthenticated
{'CODE': 'success',
'data': {'assigns_collections': True,
'collections': ['Demo Collection 1', 'Demo Collection 2'],
'concurrency_limit': 1,
'created_at': '2021-05-21 15:34:36',
'customer': None,
'deleted_at': None,
'details': 'Este es un plan que servira de aula asociada a un '
'docente',
'download_files': 0,
'duration': 12,
'free_trial': 0,
'free_trial_days': 0,
'has_geolocalized_prices': False,
'id': 2696,
'name': 'Test Plan Name',
'prices': [],
'private': 1,
'recommended': False,
'type': 'prepaid',
'updated_at': '2021-05-21 15:34:36',
'url': 'https://example.publica.la/subscribe/2696?signature={random_hash}'}}
/subscribe/2696?signature={random_hash}'}}

Update

PUT /integration-api/v1/dashboard/plans/{plan_id}

Request Body

ParameterTypeDescription.
typestringValid values: recurring, prepaid, Required
namestring
detailsstring
durationnullable, integer
recommendedboolean
privateboolean
assigns_collectionsboolean
concurrency_limitinteger
collectionslist of collections
download_filesboolean
customerstring
invoicestring
file_namestring
upload_filefile
priceslist of prices
free_trialboolean
free_trial_daysintegerThis field can be omited when free_trial is False
{
"type":"recurring",
"name":"Demo Plan",
"details":"<div><!--block-->This is the description of the Demo Plan</div>",
"duration":null,
"recommended":true,
"private":false,
"assigns_collections":true,
"concurrency_limit":"1",
"collections":[
"Prepaid"
],
"download_files":false,
"customer":"",
"invoice":"",
"file_name":"",
"upload_file":false,
"prices":{
"ARS":0,
"USD":"1",
"EUR":0,
"MXN":"1",
"COP":0,
"PEN":0,
"CLP":0,
"AUD":0,
"UYU":0,
"BOB":0,
"PYG":0,
"BRL":0,
"INR":0,
"GTQ":0,
"HNL":0
},
"free_trial":true,
"free_trial_days":"15"
}

Response

CodeDesctiption
204Object Updated
422Validation error, the reason of the error will be described in the response
info

Same rules apply for assigning collections